package main.java.niuke.dp;

public class Main {

    public static void main(String[] args) {

    }

    public int minCostClimbingStairs (int[] cost) {
        // write code here
        int n = cost.length;

        int[] dp = new int[n];
        dp[0] = cost[0];
        dp[1] = cost[1];
        for(int i= 2;i<n;i++){
            dp[i] = Math.min(dp[i-1],dp[i-2])+cost[i];
        }

        return Math.min(dp[n-1],dp[n-2]);

    }
}
